package com.xlgroup;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;

import com.xlgroup.javainterview.JavaMain;

public class AppMain extends Activity {
    /** Called when the activity is first created. */
	RadioButton javaInterView,other;
	Button enter;
	int menuFlag = 0;
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        RadioGroup radioGroup = (RadioGroup)this.findViewById(R.id.mainMenu);
		javaInterView = (RadioButton)this.findViewById(R.id.javaInterview);
		other = (RadioButton)this.findViewById(R.id.other);
		enter = (Button)this.findViewById(R.id.menuEnter);
		radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener(){
			public void onCheckedChanged(RadioGroup group,int checkedId){
				if(javaInterView.getId()==checkedId){
					Toast.makeText(AppMain.this,"java面试速查手册",Toast.LENGTH_SHORT).show();
					menuFlag = 1;
				}else if(other.getId()==checkedId){
					Toast.makeText(AppMain.this,"其他菜单",Toast.LENGTH_SHORT).show();
					menuFlag = 2;
				}
			}
		});
		enter.setOnClickListener(new Button.OnClickListener(){
			public void onClick(View v){
				if(menuFlag == 1){
					Intent intent = new Intent();
					intent.setClass(AppMain.this,JavaMain.class);
					startActivity(intent);
					AppMain.this.finish();
				}
			}
		});
        
    }

}
